var player = null;		//初始化播放器  new playerMgr (0)
var curPlayData = null;			//记录当前播放的data
var programTimerId = null;
var startP2pTime = 0;
function play(data){
	if(data == curPlayData ){			//如果是当前正在播放的
		showGTip('This channels Playing',5000);
		return ;
	}
	var date = new Date();
	startP2pTime = date.getTime();
	
	curPlayData = data;
	hideGTip();
	
	if(programTimerId){				//清理定时器
		clearInterval(programTimerId);
		programTimerId = null;
	}
	showEpgBox(data);
	
	if(player){
		player.stopPlay();
	}else{
		player =   new playerMgr (5);
	}
	
	if(data.playUrl.indexOf('igmp') >-1){
		data.playUrl ='udp'+data.playUrl.substring(4);
	}
	$.log(data.playUrl);
	
	player.addPlayerTask(data.playUrl, "", "");
	player.liveSrnMode('fullScreen');
	programTimerId = setInterval("progress()",500);
	
}

//加载进度
function progress(){
	if(!player)return ;
	var date = new Date();
	var time = date.getTime();
	
	if(time - startP2pTime > 3*1000){
		var playerState = player.getPlayerState();
		if(playerState==5){
			hideEpgBox();
			clearInterval(programTimerId);
			programTimerId = null;
		}else{
			showGTip('No Signal!',5000);
		}
	}

}